package com.lzh.others.moji;

import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

/**
 * @author LiuZiHao
 * @date 创建时间:2023年02月22日 14:47:14
 */
public class GetWeather {

    /**
     * 天气实况
     */
    private static final String CONDITION_URL = "http://aliv18.data.moji.com/whapi/json/alicityweather/condition";
    /**
     * 天气预报15天
     */
    private static final String FORECAST15DAYS_URL = "http://aliv18.data.moji.com/whapi/json/alicityweather/forecast15days";
    /**
     * AQI预报5天
     */
    private static final String AQIFORECAST5DAYS_URL = "http://aliv18.data.moji.com/whapi/json/alicityweather/aqiforecast5days";
    /**
     * api简单身份认证调用方式 appcode
     */
    private static final String APP_CODE = "05efe1ad70cb4e4aa8ac37ae40f5cb5f";

    public static void main(String[] args) {

        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.set("Authorization", "APPCODE " + APP_CODE);
        httpHeaders.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        // 封装参数
        MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
        //默认威宁县
        paramMap.add("cityId", "3042");

        RestTemplate restTemplate = new RestTemplate();

//        restTemplate.postForEntity(FORECAST15DAYS_URL,)
    }
}
